<template>
	<view>
		<view class="header">
			<view class="header__search">
				<!-- <image src="/static/home/icon.png" class="header__search__iconbox" mode=""></image> -->
				<u-search placeholder="搜索关键词" v-model="keyword" bgColor="#fff" :showAction='false' height="81rpx"
					@search="search"></u-search>
			</view>
		</view>

		<view class="scbox">
			<view class="left">
				<view :class="current==-1?'active':'item'" @click="changeId(-1)">
					全部商品
				</view>
				<view :class="item.id==current?'active':'item' " v-for="(item,index) in types" :key="index"
					@click="changeId(item.id)">
					{{item.name}}
				</view>
			</view>
			<scroll-view scroll-y="true" style="height: 100%;flex: 1;">
				<view class="right">
					<view class="product" v-for="item in 3" :key="item">
						<image src="../../static/uni.png" mode="aspectFill" class="product__pic"></image>
						<view class="product__info">
							<view class="product__info__name">
								测试商品
							</view>
							<view class="product__info__price">
								<text style="font-size: 24rpx;">￥</text>100
								<text class="product__info__old">¥200</text>
							</view>
							<view
								style="padding: 0 15rpx 20rpx 20rpx;display: flex;align-items: center;justify-content: space-between;">
								<view class="product__info__yq">
									已抢购10件
								</view>
								<view class="product__info__btn">
									马上抢购
								</view>
							</view>
						</view>
					</view>
					<view class="" style="width: 45%;">

					</view>
				</view>
				<view class="" v-if="list.length==0" style="width: 100%;display: flex;justify-content: center;">
					<u-empty mode="data" icon="http://cdn.uviewui.com/uview/empty/data.png">
					</u-empty>
				</view>

			</scroll-view>

		</view>
	</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				keyword: '',
				types: [{
					id: 1,
					name: '关注',
				}, {
					id: 2,
					name: '推荐',
				}, {
					id: 3,
					name: '电影'
				}],
				current: -1,
				list: []
			}
		},
		onLoad() {

		},
		methods: {
			search() {

			},
			changeId(id) {
				if (id == this.current) return;
				this.current = id;

			},
			clickto(item) {

			}
		}
	}
</script>
<style>
	page {
		background-color: #F6F6F6;
	}
</style>
<style scoped lang="scss">
	.header {
		&__search {
			padding: 40rpx 23rpx;
			display: flex;
			align-items: center;

			&__iconbox {
				width: 80rpx;
				height: 80rpx;
				margin-right: 18rpx;
			}

		}
	}

	.scbox {
		height: calc(100vh - 166rpx);

		display: flex;

		.container {
			padding: 0 23rpx;
		}

		.left {
			width: 160rpx;
			background-color: white;
			height: 100%;
			overflow: auto;

			.item {
				color: grey;
				text-align: center;
				padding: 12rpx 4rpx;
			}

			.active {
				color: #0AA694;
				font-weight: 600;
				text-align: center;
				padding: 12rpx 4rpx;
			}
		}

		.right {
			display: flex;
			justify-content: space-evenly;
			flex-wrap: wrap;

			.product {
				width: 45%;
				background-color: #fff;
				margin-bottom: 27rpx;
				height: 484rpx;
				border-radius: 15rpx;

				&__pic {
					width: 100%;
					height: 284rpx;
					background: #D9D9D9;
					border-radius: 15rpx 15rpx 0rpx 0rpx;
				}

				&__info {
					width: 100%;
					height: 169rpx;
					background: #FFFFFF;
					border-radius: 0rpx 0rpx 15rpx 15rpx;

					&__vip {
						width: 37rpx;
						height: 18rpx;
						margin-right: 2rpx;
					}

					&__name {
						font-family: PingFang SC;
						font-weight: 500;
						font-size: 28rpx;
						color: #181818;
						line-height: 28rpx;
						padding: 10rpx 20rpx 29rpx;
					}

					&__price {
						font-family: DIN Next LT Pro;
						font-weight: 500;
						font-size: 36rpx;
						color: #FD2A00;
						line-height: 36rpx;
						padding-left: 20rpx;
					}

					&__old {
						font-family: PingFang SC;
						font-weight: 500;
						font-size: 22rpx;
						color: #919191;
						line-height: 22rpx;
						text-decoration-line: line-through;
						margin-left: 8rpx;
					}

					&__yq {
						border-radius: 5rpx;
						border: 2rpx solid rgba(217, 217, 217, .3);
						font-family: PingFang SC;
						font-weight: 500;
						font-size: 19rpx;
						color: #6A6A6A;
						line-height: 26rpx;
					}

					&__btn {
						width: 105rpx;
						height: 51rpx;
						background: #ECFDEC;
						border-radius: 26rpx;
						display: flex;
						align-items: center;
						justify-content: center;
						font-family: PingFang SC;
						font-weight: 500;
						font-size: 20rpx;
						color: #2F3931;
						line-height: 24rpx;
					}
				}
			}
		}
	}
</style>